<template>
<table>
    <tr>
        <td>投资项目名称</td>
        <td><input type="text" v-model="info.Name"></td>
    </tr>
    <tr>
        <td>投资项目总金额</td>
        <td><input type="text" v-model="info.Sumprice"></td>
    </tr>
    <tr>
        <td colspan="2"><input type="button" @click="AddInfor" value="添加"></td>
    </tr>
</table>
</template>
<script setup lang="ts">
import axios from 'axios';
import {ref}from 'vue'

const info=ref(
    {
        Name:'',
        Sumprice:0,
        Yprice:0,
        Sprice:0,
        Num:0
    }
)
const AddInfor=()=>{
    axios.post('https://localhost:44351/api/Lx/AddInfor',
        {
            Name:info.value.Name,
            Sumprice:info.value.Sumprice,
            Yprice:info.value.Yprice,
            Sprice:info.value.Sprice,
            Num:info.value.Num
        }
    ).then(res=>{
        if(res.data>0){
            alert("添加成功")
        }
    }).catch(err=>{
        console.log(err)
    })
}


</script>